<template>
  <div>
	  <div class="header  text-white " style="display: flex;width: 100%;justify-content: space-between;">
	  	<!-- <span style="-webkit-app-region: drag;display: flex;width: 100%;justify-content: start;align-items: center;" > -->
	  	<span class="drag" style="pointer-events:none;display: flex;width: 100%;justify-content: start;align-items: center;" >
			<p class="title" >蒲公英自动化上传工具 by: lzw</p>
			<iframe ref="tianqi" frameborder="0" width="280" height="36" scrolling="no" hspace="0" src="https://i.tianqi.com/?c=code&id=99" style=""></iframe>
		</span>
		<span class="float-right btn-opt text-white" style="display: flex;align-items: center;cursor: pointer;">
	  		<svg @click="toMin()" t="1616668025021" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4247" width="30" height="30"><path d="M213.333333 469.333333m21.333334 0l554.666666 0q21.333333 0 21.333334 21.333334l0 42.666666q0 21.333333-21.333334 21.333334l-554.666666 0q-21.333333 0-21.333334-21.333334l0-42.666666q0-21.333333 21.333334-21.333334Z" p-id="4248" fill="#1296db"></path></svg>
	  		<svg style="margin-right: 10px;" @click="toClose()" t="1616667849931" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2182" width="20" height="20"><path d="M512.001 15.678C237.414 15.678 14.82 238.273 14.82 512.86S237.414 1010.04 512 1010.04s497.18-222.593 497.18-497.18S786.589 15.678 512.002 15.678z m213.211 645.937c17.798 17.803 17.798 46.657 0 64.456-17.798 17.797-46.658 17.797-64.456 0L512.001 577.315 363.241 726.07c-17.799 17.797-46.652 17.797-64.45 0-17.804-17.799-17.804-46.653 0-64.456L447.545 512.86 298.79 364.104c-17.803-17.798-17.803-46.657 0-64.455 17.799-17.798 46.652-17.798 64.45 0l148.761 148.755 148.755-148.755c17.798-17.798 46.658-17.798 64.456 0 17.798 17.798 17.798 46.657 0 64.455L576.456 512.86l148.756 148.755z m0 0" fill="#d81e06" p-id="2183"></path></svg>
	  	</span>
	  </div>
  </div>
</template>

<script> 
const { ipcRenderer } = window.require('electron')
const currentWindow = window.require('electron')
// 
export default {
  name: 'MyHeader',
  data() {
      return {
  		  isMax:0
  	  }
  },
  mounted () {
	  // currentWindow.setResizeable(true)
	  // currentWindow.setMovable(true)
	  // currentWindow.setMaxmizable(true)
      const iframe = this.$refs['tianqi']
      iframe.addEventListener('load', () => {
        const a = iframe.contentDocument.querySelector('a')
        a.style.color = 'white'
      })
  },
  methods: {
	toMin () {
		ipcRenderer.send('min-app')
	},
	toMax () {
		if(this.isMax==0) {
			this.isMax=1
		} else {
			this.isMax=0
		}
		ipcRenderer.send('max-app',this.isMax)
	},
	toClose () {
		ipcRenderer.send('close-app')
	}
  }
}
</script>

<style>
.header {
	background-color: #ffffff;
	z-index: 1111;
 top: 0;
  position: fixed;
  width: 100%;
  display: flex;
  align-items: flex-start;
  /* -webkit-app-region: drag;  */
}
.title {
	cursor: pointer;
	font-weight: bold;
	margin: 10px;
}
div {
}

.drag {
    /* 设置该属性表明这是可拖拽区域，用来移动窗口 */
    -webkit-app-region: drag;
}
</style>
